package com.atguigu.gmall.task.t0;

import com.atguigu.gmall.mq.config.MqConst;
import com.atguigu.gmall.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: 李旭
 * @Time: 9:40
 * @Description:
 *
 *  半夜将DB中数据导入到缓存 中
 */
@Component
public class Task0 {


    @Autowired
    private RabbitService rabbitService;
    //半夜12点执行
    //@Scheduled(cron = "0 0 0 * * ?")
    @Scheduled(cron = "0/5 * * * * ? ")
    public void task0(){
        //队列
        //闹铃 叫醒我们
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_1,
                "");
        System.out.println("执行task0");
    }



}
